<!DOCTYPE html>
<html>

<head>
    <include file="Share:meta" />
    <style type="text/css">
    .trstyle0 {
        background-color: #e8e8e8;
    }
    .noty_message_h{ height:230px; padding:15px; text-align:center; }
	
    .noty_text{ font-size: 16px; font-weight: bold; }
    .desc{ font-size: 12px; color: #999; }
	.mybutton { width:200px; margin-bottom:10px; overflow:hidden; cursor:default; }
	.mybutton2 { display:block; margin-top:5px; width:72px; height:25px; line-height:20px; }
    </style>
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        <include file="Share:header" />
        <include file="Share:left" />
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>订单列表<small><a target="_blank"></a></small></h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li class="active">订单列表</li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">
                            <a class="btn btn-info" href="__APP__/Admin/order/elist/" role="button">全部</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/elist/order_status/1" role="button">未支付</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/elist/order_status/7" role="button">已支付</a>
                            <a class="btn btn-info" href="__APP__/Admin/order/elist/order_status/11" role="button">已完成</a>
                        </h3>
                        <div class="box-tools">
                            <form action="" method="GET" role="form">
                                <div class="input-group input-group-sm" style="width: 250px;">
                                    <input type="text" name="osid" class="form-control pull-right" placeholder="订单号">
                                    <div class="input-group-btn">
                                        <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-footer clearfix">
                        <ul class="pagination pagination-sm no-margin pull-right">
                            {$show}
                        </ul>
                    </div>
                    <div class="box-body">
                    	<table class="table table-bordered HjTable" border="1">
                            <tbody>
                                <tr style="background-color: #E6E6FA;">
                                    <th style="width: 6%;">订单号</th>
                                    <th style="width: 8%;">订单金额</th>
                                    <th style="width: 6%;">数量</th>
                                    <th style="width:10%;">订单状态</th>
                                    <th style="width:23%;">联系人</th>
                                    <th style="width:12%;">名片属性</th>
                                    <th style="width:15%;">下单时间</th>
                                    <th style="width:15%">操作</th>
                                </tr>
                                <volist name="list" id="vo">
                                    <tr class='trstyle{$vo.status}'>
                                        <td id="order_{$vo.osid}">{$vo.osid}</td>
                                        <td>{$vo.order_price}</td>
                                        <td>{$vo.count}</td>
                                        <td>{$orderStatus[$vo[order_status]]}</td>
                                        <td>
                                            {$vo.shipping_name} / {$vo.shipping_mobile}
                                            <br> {$vo.shipping_province}{$vo.shipping_city}{$vo.shipping_distinct}
                                            <br> {$vo.shipping_address}
                                        </td>
                                        <td>
                                        <p>{$vo.product_product_name}</p>
                                        </td>
                                        <td>{$vo.ctime}</td>
                                        <td>
                                            <a class="btn btn-info" style="margin-bottom: 5px; display:none;" href="__APP__/Admin/Order/detail/order_no/{$vo.order_no}" role="button">查看详情</a>
                                            <eq name="vo.order_status" value="1">
                                                <button type="button" style="margin-bottom: 5px;" onClick="Pay('{$vo.order_no}')" class="btn btn-info">支付订单</button>
                                            </eq>

                                            <eq name="Think.session.info.rid" value="1">
                                                <eq name="vo.order_status" value="7">
                                                    <button type="button" style="margin-bottom: 5px;" onClick="Finish('{$vo.osid}')" class="btn btn-info">订单完成</button>
                                                </eq>
                                            </eq>
                                        </td>
                                    </tr>
                                </volist>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer clearfix">
                        <ul class="pagination pagination-sm no-margin pull-right">
                            {$show}
                        </ul>
                    </div>
                </div>
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->
        <include file="Share:copyright" />
        <include file="Share:setting" />
    </div>
    <include file="Share:js" />
    <script type="text/javascript">
    $("#OrderManager").addClass("active");
    $("#experience_list").addClass("active");

    function Pay(order_no) {
        noty({
            text: "<img src='__APP__/Admin//pay/wxpay/order_no/"+order_no+"'/><br/>支付成功后，请刷新页面查看订单状态",
            layout: 'center',
            template: '<div class="noty_message_h"><span class="noty_text"></span><div class="noty_close"></div></div>',
            buttons: [
				{
                addClass: 'btn btn-danger',
                text: '关闭',
                onClick: function($noty) {
                    $noty.close();
					window.location.reload();
                }
            }]
        });
    }
	
	function Finish(order_no) {
        noty({
            text: '<br/>确认该订单支付完成：'+order_no+" ？",
            layout: 'center',
            template: '<div class="noty_message_h" style="height:90px;"><span class="noty_text"></span><div class="noty_close"></div></div>',
            buttons: [{
                addClass: 'btn btn-primary',
                text: '确定',
                onClick: function($noty) {
                    $noty.close();
                    window.location.href="__APP__/Admin/Order/finish_e_order?osid="+order_no+"&p={$Think.get.p|default=1}";
                }
            }, {
                addClass: 'btn btn-danger',
                text: '取消',
                onClick: function($noty) {
                    $noty.close();
                }
            }]
        });
    }

    </script>
</body>

</html>
